package org.one.afternoon.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.one.afternoon.domain.ClientUser;
import org.one.afternoon.mapper.ClientUserMapper;
import org.one.afternoon.service.ClientUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientUser> implements ClientUserService {
    @Autowired
    private ClientUserMapper clientUserMapper;
    @Override
    public boolean login(ClientUser clientUser) {
        // 去数据库查找用户
        ClientUser cu = clientUserMapper.findClientUser(clientUser.getPhone());
        if (cu == null) {
            //用户不存在！
            return false;
        }
        if (!cu.getPassword().equals(cu.getPassword())) {
            //用户名或者密码错误！
            return false;
        }
        return true;
    }
}
